<template>
    <div class="default-main ba-table-box">
        <!-- 表格顶部菜单 -->
        <TableHeader
            :buttons="['refresh', 'comSearch']"
        />

        <!-- 表格 -->
        <!-- 要使用`el-table`组件原有的属性，直接加在Table标签上即可 -->
        <Table ref="tableRef"/>
    </div>
</template>

<script setup lang="ts">

import {ref, provide} from 'vue'
import baTableClass from '/@/utils/baTable'
import Table from '/@/components/table/index.vue'
import TableHeader from '/@/components/table/header/index.vue'
import {baTableApi} from '/@/api/common'
import {useI18n} from 'vue-i18n'
const {t} = useI18n();
const tableRef = ref();

const baTable = new baTableClass(
    new baTableApi('/admin/routine.Sms/'),
    {
        column: [
            {
                label: t('Id'),
                prop: 'id',
                align: 'center',
                operator: '=',
                operatorPlaceholder: t('Id'),
                width: 70
            },
            {
                label: t('phone'),
                prop: 'phone',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('Fuzzy query')
            },
            {
                label: t('验证码'),
                prop: 'code',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('Fuzzy query'),
                render: 'tag',
            },
            {
                label: t('来源'),
                prop: 'source',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('Fuzzy query'),
                render: 'tag',
            },
            {
                label: t('IP'),
                prop: 'ip',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('Fuzzy query'),
                render: 'tag',
            },
            {
                label: t('Create time'),
                prop: 'create_time',
                align: 'center',
                render: 'datetime',
                sortable: 'custom',
                operator: 'RANGE',
                width: 160
            },
        ],
        dblClickNotEditColumn: [undefined],
    },
    {
        defaultItems: {
            gender: 0,
            money: '0',
            score: '0',
            status: 'enable',
        },
    }
)

baTable.mount()
baTable.getIndex()

provide('baTable', baTable)
</script>

<style scoped lang="scss"></style>
